#pragma once
#include <qbprotocol/include/SSMsgStruct.h>
#include <qbprotocol/include/SSQBModel.h>
#include <qbtools/message/MessagePoster.h>
#include <widgets/SPopupWindow.h>
#include <widgets/STabCtrl.h>

#include <QScrollArea>
#include <QStylePainter>

#include "AIPanelDataAuthority.h"
#include "AIPanelDataBroker.h"
#include "AIPanelDataCDC.h"
#include "AIPanelDataCSI.h"
#include "AIPanelDataExcel.h"
#include "AIPanelDataIMSales.h"
#include "AIPanelInfo.h"
#include "AccountInfoMenu.h"

enum e_Panel {
  PanelInfo = 0,       // 个人资料
  PanelContactBroker,  // 常用经纪人
  PanelDataBroker,     // 经纪商
  PanelDataCFETS,      // CFETS
  PanelDataSSE,        // 上交所
  PanelDataSZE,        // 深交所
  PanelDataCDC,        // CDC
  PanelDataCSI,        // CSI
  PanelDataIMSales,    // 一级销售
  PanelDataExcel,      // Excel插件
  PanelNum
};

enum type {
  typeNone = 0,
  typeBond,
  typeIRS,
  typeNCD,
  typeNCD_P,
  typeKungfuBond,
  typeInvalid
};

class AccountInfo : public SPopupWindow, public MessageReceiver {
  Q_OBJECT
 public:
  AccountInfo(QWidget* parent = nullptr);
  typedef CAccountInfoMenu Menu;
  bool SetPanelSelect(const QString& sel);

 protected:
  virtual void DrawMain();

  void Resize();
  void resizeEvent(QResizeEvent* event);
  virtual void mousePressEvent(QMouseEvent* event) override;
  void onDataArrived(const qb::SSAckMsg& msg) override;
  void paintEvent(QPaintEvent* event) override;
  void showEvent(QShowEvent*) override;
  void CreateMenus();
  void SetScroolHeight(int x, int y);

 signals:
  void showup();

 protected:
  Menu m_Menu;                    // 左侧菜单
  CAIPanelInfo* pInfo1;           // 基础信息
  CAIPanelDataBroker* pInfo2;     // 数据权限-经纪商
  CAIPanelDataAuthority* pInfo3;  // 数据权限-CFETS
  CAIPanelDataAuthority* pInfo4;  // 数据权限-上交所
  CAIPanelDataAuthority* pInfo5;  // 数据权限-深交所
  CAIPanelDataCDC* pInfo6;        // 中债
  CAIPanelDataCSI* pInfo7;        // 中证
  CAIPanelDataIMSales* pInfo8;    // 一级销售
  CAIPanelDataExcel* pInfo9;      // EXCEL插件
  CAIPanelBase* m_pPanels[PanelNum];
  // CTitleTip		m_titleTip; 		// 提示窗口,首次展示时创建
 protected:
  QString m_szInitTag;  // 启动参数
  QFont m_lfHead;       // 字体
  QFont m_lfContent;    // 字体
  xQBServicePlatformManagerAck_c m_ServicePlatfrom;
  QColor m_crHead;
  QPushButton* m_btnAccountInfo = nullptr;
  STabCtrl* m_MenuTab;
  QRect m_Rect;
  QRect m_rcPwd;
  QRect m_rcVerify;  // 手机
  int m_height;      // 全局高度
  bool m_dragging = false;
  QWidget* m_panelWidget = nullptr;
  QScrollArea* scrollArea;
  // IQMCallback_Comm --------------------------------------------------------
  // begin
};
